package com.jzsqdy.mycat;


import com.jzsqdy.mycat.common.PointDao;
import com.jzsqdy.mycat.domain.Statistic;
import com.jzsqdy.mycat.thread.Data;
import com.jzsqdy.mycat.thread.Query;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 主程序入口
 * @author chenjf
 */
public class App {
    public static void main(String[] args) {

        System.out.println("Hello World!");

//        System.setProperty("jzsqdy.server","mycat");
//        System.setProperty("jzsqdy.rule","murmur");
        System.setProperty("jzsqdy.server","mysql");

//        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-context-mycat.xml");
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-context-mysql.xml");

        PointDao pointDao = context.getBean(PointDao.class);
        System.out.println(pointDao);

        Statistic statistic = new Statistic();

        Data data = new Data(pointDao,statistic);
        Query query = new Query(pointDao,statistic);
//        int[] array = new int[]{3000,5000};
//        int[] array = new int[]{3000,5000,90000,120000,300000};
//        for (int i : array){
//            double time = data.data(i);
//            System.out.println(statistic.getData()+" : "+time);
//            query.query();
//        }

        new Thread(data).start();
        new Thread(data).start();
        new Thread(data).start();
        new Thread(query).start();

        query.query("33d7be04-ee10-45fd-9321-93acf79959fc");
//        query.query("40384a40-4879-4838-a14b-4556b1649554");

    }
}
